﻿using System;

namespace MyApp
{ 
    public class Program
    {
        static void Main(string[] args)
        {
            Form form = new Form();
            int hour = 0, min = 0;
            for(int i = 0; i < 10; i++)
            {
                min += 20;
                if(min == 60)
                {
                    hour += 1;
                    min = 0;
                }

                form.clock.setTime(hour, min);
            }
        }
    }

    public delegate void ClockHandler(object sender, Timeargs args);

    public class Timeargs
    {
        public int hour;
        public int minute;
    }

    public class Clock
    {
        public event ClockHandler report;
        public void setTime(int h,int m)
        {
            Console.WriteLine("time now is {0} hour {1} min", h, m);
            Timeargs args = new Timeargs()
            {
                hour = h,
                minute = m
            };
            report(this, args);
        }
    }

    public class Form
    {
        public Clock clock = new Clock();

        public Form()
        {
            clock.report += new ClockHandler(tiktok);
            clock.report += new ClockHandler(ring);
        }


        void tiktok(object sender, Timeargs args)
        {
            if (args.minute != 0) Console.WriteLine("tiktok");

        }
        void ring(object sender, Timeargs args)
        {
            if (args.minute == 0) Console.WriteLine("ringringring");
        }
    }

}